package com.alianzamedica.controllers.lot;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.objectsearch.sqlsearch.ObjectSearch;
import org.w3c.dom.Document;

import com.alianzamedica.businessobject.Doctor;
import com.alianzamedica.connection.ConnectionImpl;
import com.alianzamedica.tools.Enviroment;

/**
 * @author carlos
 * 
 */
public class LotWizardView extends Action {

	@SuppressWarnings("unchecked")
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Enviroment env = Enviroment.getInstance();
		Document doc = env.getDocument();
		ConnectionImpl impl = new ConnectionImpl();
		ObjectSearch search = new ObjectSearch(doc, impl);
		Doctor doctor = new Doctor();
		ArrayList<Doctor> medicList = search.searchObjects(doctor);
		request.setAttribute("medics", medicList);

		return mapping.findForward("success");
	}

}
